/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ScreenLayouts;

import GUI.Button;
import GUI.GUIItem;
import GUI.HotKeyProvider;
import GUI.Line;
import GUI.Title;
import java.awt.Font;
import java.awt.event.KeyEvent;
import stealth.GameManager;
import stealth.GameState;
import stealth.Main;

/**
 *
 * @author Joshua
 */
public class MainMenuLayout implements ScreenLayout {

    public MainMenuLayout() {
        gameButton = new Button(200, 5, 150, 40, "New Game", new Runnable() {

            @Override
            public void run() {
                GameState.setState(GameState.ONE_PLAYER_GAME_STATE);
            }
        });
        scoresButton = new Button(351, 5, 150, 40, "High Scores", new Runnable() {

            @Override
            public void run() {
                GameState.setState(GameState.SCORE_STATE);
            }
        });

        settingsButton = new Button(502, 5, 150, 40, "Change Name", new Runnable() {

            @Override
            public void run() {
                GameState.setState(GameState.NAME_CHANGE_STATE);
            }
        });

        exitButton = new Button(653, 5, 150, 40, "Exit/ESC key", new Runnable() {

            @Override
            public void run() {
                GameState.setState(GameState.NAME_CHANGE_STATE);
                GameManager.handleGameEnd();
                Main.gameLoader.stop();
                System.exit(0);
            }
        });

        gameTitle = new Title(25, 25, "SPACE ", new Font("Courier", Font.BOLD, 26));

        escapeHotKey = new HotKeyProvider(KeyEvent.VK_ESCAPE,
                new Runnable() {

                    @Override
                    public void run() {
                        GameState.setState(GameState.NAME_CHANGE_STATE);
                        GameManager.handleGameEnd();
                        Main.gameLoader.stop();
                        System.exit(0);
                    }
                }, true);

        buttonLineOne = new Line(0, 60, Main.game.getWidth(), false);
        buttonLineTwo = new Line(0, 59, Main.game.getWidth(), false);
        buttonLineThree = new Line(0, 58, Main.game.getWidth(), false);
        items = new GUIItem[]{escapeHotKey, gameButton, scoresButton, settingsButton, exitButton, gameTitle, buttonLineOne, buttonLineTwo, buttonLineThree};
    }
    String name = "MainMenuScreen";
    Button gameButton, scoresButton, settingsButton, exitButton;
    Title gameTitle;
    HotKeyProvider escapeHotKey;
    Line buttonLineOne, buttonLineTwo, buttonLineThree;
    private GUIItem[] items;

    @Override
    public GUIItem[] getItems() {
        return items;
    }
}
